import Matrix2D from "../maths/Matrix2D";
import ITransformable from "../interfaces/ITransformable";
import Line from "./Line";
import IRenderState from "../interfaces/IRenderState";

export default class Bone extends Line {
    // override覆写基类type只读属性
    public get type(): string { return "Bone"; }

    public draw(transformable: ITransformable, state: IRenderState, context: CanvasRenderingContext2D): void {
        super.draw(transformable, state, context);

        let mat: Matrix2D = transformable.getWorldMatrix();
        context.save();
        context.setTransform(1, 0, 0, 1, mat.values[4], mat.values[5]);
        context.beginPath();
        context.fillStyle = 'blue';
        context.arc(this.start.x, this.start.y, 5, 0, Math.PI * 2);
        context.fill();
        context.restore();
    }
}